/**
 * <strong>Title : BOMComponent.java<br>
 * </strong> <strong>Package : cn.b.sky.mes.cm.model<br>
 * </strong> <strong>Description : </strong>@类注释说明写在此处@<br>
 * <strong>Create on : 2016年1月18日 上午11:07:58<br>
 * </strong>
 * <p>
 * @author dapeng.li<br>
 * @version <strong>v1.0.0</strong><br>
 * <br>
 *          <strong>修改历史:</strong><br>
 *          修改人 | 修改日期 | 修改描述<br>
 *          -------------------------------------------<br>
 * <br>
 * <br>
 */
package cn.b.sky.mes.cm.model;

import java.util.List;

import cn.b.sky.common.model.ImeCommon;

/**
 * <strong>Title : BOMComponent.java<br></strong>
 * <strong>Package : cn.b.sky.mes.cm.model<br></strong>
 * <strong>Description : </strong>物料清单组件<br> 
 * <strong>Create on : 2016年1月18日 上午11:07:58<br></strong>
 * <p>
 * @author dapeng.li<br>
 * @version <strong>v1.0.0</strong><br>
 * <br>
 * <strong>修改历史:</strong><br>
 * 修改人 | 修改日期 | 修改描述<br>
 * -------------------------------------------<br>
 * <br>
 * <br>
 */
public class BOMComponent extends ImeCommon {

  /** 
   * id
   */
  private long id;

  /** 
   * bom编号
   */
  private String bomCode;

  /** 
   * bom描述
   */
  private String componentText;

  /** 
   * bom组件编号
   */
  private String componentCode;

  /** 
   * 数量
   */
  private Double quantity;

  /**
   * 物料类型描述
   */
  private String materialTypeText;

  /**
   * 自制件标记
   */
  private Integer makeFlag = 0;

  /**
   * 采购件标记
   */
  private Integer buyFlag = 0;

  /**
   * 该组件的子级BOM编号
   */
  private String childBomCode;

  private List<BOMComponent> childComponents;

  public BOMComponent() {
    super();
  }

  public BOMComponent(Material material) {
    super();
    this.setComponentCode(material.getMaterialCode());
    this.setComponentText(material.getMaterialText());
    this.setQuantity(1d);
    this.setMaterialTypeText(material.getMaterialTypeText());
    this.setMakeFlag(material.getMakeFlag());
    this.setBuyFlag(material.getBuyFlag());
    this.setChildBomCode(material.getBomCode());
  }

  /** 
  * @return id
  */
  public long getId() {
    return id;
  }

  /** 
  * @param id 要设置的 id
  */
  public void setId(long id) {
    this.id = id;
  }

  /** 
  * @return bomCode
  */
  public String getBomCode() {
    return bomCode;
  }

  /** 
  * @param bomCode 要设置的 bomCode
  */
  public void setBomCode(String bomCode) {
    this.bomCode = bomCode;
  }

  /** 
  * @return componentText
  */
  public String getComponentText() {
    return componentText;
  }

  /** 
  * @param componentText 要设置的 componentText
  */
  public void setComponentText(String componentText) {
    this.componentText = componentText;
  }

  /** 
  * @return componentCode
  */
  public String getComponentCode() {
    return componentCode;
  }

  /** 
  * @param componentCode 要设置的 componentCode
  */
  public void setComponentCode(String componentCode) {
    this.componentCode = componentCode;
  }

  /** 
  * @return quantity
  */
  public Double getQuantity() {
    return quantity;
  }

  /** 
  * @param quantity 要设置的 quantity
  */
  public void setQuantity(Double quantity) {
    this.quantity = quantity;
  }

  public String getMaterialTypeText() {
    return materialTypeText;
  }

  public void setMaterialTypeText(String materialTypeText) {
    this.materialTypeText = materialTypeText;
  }

  public Integer getMakeFlag() {
    return makeFlag;
  }

  public void setMakeFlag(Integer makeFlag) {
    this.makeFlag = makeFlag;
  }

  public Integer getBuyFlag() {
    return buyFlag;
  }

  public void setBuyFlag(Integer buyFlag) {
    this.buyFlag = buyFlag;
  }

  /** 
  * @return childComponents
  */
  public List<BOMComponent> getChildComponents() {
    return childComponents;
  }

  /** 
  * @param childComponents 要设置的 childComponents
  */
  public void setChildComponents(List<BOMComponent> childComponents) {
    this.childComponents = childComponents;
  }

  /** 
  * @return childBomCode
  */
  public String getChildBomCode() {
    return childBomCode;
  }

  /** 
  * @param childBomCode 要设置的 childBomCode
  */
  public void setChildBomCode(String childBomCode) {
    this.childBomCode = childBomCode;
  }

  @Override
  public boolean equals(Object o) {
    return ((BOMComponent) o).id == this.id;
  }

  @Override
  public int hashCode() {
    return (int) id;
  }

}
